package com.fruit.account.common;

import java.math.BigDecimal;

import com.fruit.pojo.user.sysmsg.SysMessage;
import com.fruit.util.DateUtil;

/**
 * 二级返销相关常量
 * 
 * @author Administrator
 *
 */
public class CommMsgUtil {
	public static final String title = "邀请奖励";
	public static final String content = "您于${time}到账${money}元环保奖励，由${phone}提供";
	/**
	 * 构建返销发送消息体
	 * @param userId
	 * @param money
	 * @param phone
	 * @return
	 */
	public static SysMessage getMsgForComm(Integer userId, BigDecimal money, String phone) {
		SysMessage msg = new SysMessage();
		msg.setUserId(userId);
		msg.setType("03");// 邀请奖励
		msg.setMsgType("00");//通知
		msg.setTitle(title);
		msg.setState("00");// 未读取
		msg.setCreateTime(DateUtil.getTime());
		String msgBody = content;
		msgBody = msgBody.replace("${time}", DateUtil.getChinaTime()).replace("${money}", String.valueOf(money.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()))
				.replace("${phone}", phone);
		msg.setContent(msgBody);
		return msg;
	}
}
